
import java.net.*;
import java.io.*;

public class EchoServerThread extends Thread {
    private Socket socket = null;

    public EchoServerThread(Socket socket) {
		super("EchoServerThread");
		this.socket = socket;
    }

    public void run() {

		try {
		    BufferedReader in = new BufferedReader(
					    new InputStreamReader(
					    socket.getInputStream()));

		    String input;

		    while ((input = in.readLine()) != null) {
				System.out.println(input);
		    }
		    in.close();
		    socket.close();

		} catch (IOException e) {
		    e.printStackTrace();
		}
    }
}